package edu.cuc.learningAkka.chap1;

import akka.actor.ActorRef;
import akka.actor.ActorSystem;
import akka.actor.Props;
import org.junit.Test;

import static org.junit.Assert.assertEquals;

/**
 * Created by bingruiqi on 2017/9/9.
 */
public class AkkademyDbTest {
    ActorSystem system = ActorSystem.create();
    @Test
    public void itShouldPlaceKeyValueFromSetMessageIntoMap() {
//        TestActorRef<AkkademyDb> actorRef =
//                TestActorRef.create(system, Props.create(AkkademyDb.class));
//        actorRef.tell(
//                new SetRequest("key", "value"), ActorRef.noSender());
//        AkkademyDb akkademyDb = actorRef.underlyingActor();
//        assertEquals(akkademyDb.map.get("key"), "value"); }
        ActorRef actorRef = system.actorOf(Props.create(AkkademyDb.class));
        actorRef.tell(new SetRequest("key","value"),ActorRef.noSender());
    }
}
